﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Globalization;
using System.Threading;

namespace RedHouse.Web.common
{
    public class PageBase:Page
    {
        protected override void InitializeCulture()
        {
            Session["Culture"] = Session["Culture"] == null ? "vi-VN" : Session["Culture"].ToString();

            if (Session["Culture"].ToString() == "en-US")
            {
                //Session["Culture"] = "en-US";
                Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
                Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
                ///<remarks>
                ///Saving the current thread's culture set by the User in the Session
                ///so that it can be used across the pages in the current application.
                ///</remarks>
                Session["UICulture"] = Thread.CurrentThread.CurrentUICulture;
                Session["Culture"] = "en-US";
            }
            else
            {
                //Session["Culture"] = "vi-VN";
                Thread.CurrentThread.CurrentUICulture = new CultureInfo("vi-VN");
                Thread.CurrentThread.CurrentCulture = new CultureInfo("vi-VN");
                ///<remarks>
                ///Saving the current thread's culture set by the User in the Session
                ///so that it can be used across the pages in the current application.
                ///</remarks>
                Session["UICulture"] = Thread.CurrentThread.CurrentUICulture;
                Session["Culture"] = "vi-VN";
            }
        }
    }
}